Skip to main content
Version: 16.12.0

config_elements

ConfigElement

class ConfigElement()

A Content Management Policy configuration element which has a name, and can have attributes, switches, and subelements.

__init__

def __init__(
name: str,
attributes: dict = {},
switches: list = [],
subelements: list = [],
default: Optional[str] = None,
default_switches: list = [],
config: dict = {},
switches_module: "glasswall.content_management.switches" = Switch)

__str__

def __str__()

__getattr__

def __getattr__(name)

__repr__

def __repr__()

Change string representation of object.

__lt__

def __lt__(other)

Used for sorting. Sort by "name" then "switches".

text

@property
def text()

String representation of XML.

get_switch_names

def get_switch_names()

Returns a sorted list of unique Switch.name values from self.switches.

remove_switch

def remove_switch(switch: Union[Switch, str])

Removes all Switch instances from self.switches that match arg "switch".

Arguments:

  • switch Union[Switch, str] - A Switch instance or str to match Switch.name.

Returns:

self

Raises:

  • glasswall.content_management.errors.switches.SwitchNotFound - The switch was not found.

add_switch

def add_switch(switch: Switch, replace: bool = True)

Adds a Switch instance to self.switches.

Arguments:

  • switch Switch - A Switch instance.
  • replace bool, optional - Default True. Deletes any pre-existing Switch with the same .name attribute in self.switches.

Returns:

self

archiveConfig

class archiveConfig(ConfigElement)

An archiveConfig ConfigElement.

Arguments:

  • default str - The default action: no_action, discard, or process.

    Key word arguments can be specified to change individual switch values: archiveConfig(default="no_action", jpeg="discard", pdf="process")

__init__

def __init__(default: str = "process", attributes: dict = {}, **kwargs)

textSearchConfig

class textSearchConfig(ConfigElement)

A textSearchConfig ConfigElement.

textSearchConfig( libVersion="core2", textList_subelements=[ {"name": "textItem", "switches": [ {"name": "text", "value": "generic"}, {"name": "textSetting", "@replacementChar": "*", "value": "redact"}, ]} ] )

__init__

def __init__(attributes: dict = {}, textList_subelements: list = [], **kwargs)

textList

class textList(ConfigElement)

A textList ConfigElement.

__init__

def __init__(subelements: list = [])